package net.zjitc;

import net.zjitc.mapper.UserMapper;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
@Service
public class UserService {
    @Resource
    UserMapper userMapper;
    String name;
    List<String> sList;
    Map<String,String> map;
    Properties properties;
    Set<String> set;


    public void setName(String name) {
        this.name = name;
    }

    public void setsList(List<String> sList) {
        this.sList = sList;
    }

    public void setMap(Map<String, String> map) {
        this.map = map;
    }

    public void setProperties(Properties properties) {
        this.properties = properties;
    }

    public void setSet(Set<String> set) {
        this.set = set;
    }

    public void setUserMapper(UserMapper userMapper) {
        this.userMapper = userMapper;
    }

    public void init(){
        System.out.println("init...");
    }
    public void show(){

        userMapper.addUser();
        System.out.println("name:"+name);
        for(String s:sList){
            System.out.println(s);
        }

        for(String key:map.keySet()){//keySet获取map集合key的集合  然后在遍历key即可
            String value = map.get(key).toString();
            System.out.println("key:"+key+" vlaue:"+value);
        }
        for(Object o:properties.keySet()){
            System.out.println(properties.get(o));
        }
        for(String s:set){
            System.out.println(s);
        }
    }
    public void save(){
        System.out.println("save....");
        userMapper.addUser();
        System.out.println("service");
    }
    public void destory(){
        System.out.println("destory...");
    }
}
